home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FILES.SWG / 0003_FILEMODE.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  40 lines

  1. RB > I use a shared File to transfer info between
  2.    > multitasker Windows that are running the same application.
  3.    > Lately, I have been getting Runtime errors 2, 5 & 162 in the following spo
  4.  
  5. Try to set the "FileMode" Constant to 66 (read/Write) or
  6. 64 (read) beFore opening it.  Here's a map of valid values
  7. to FileMode:
  8.  
  9.                                ----- Sharing Method -----
  10. Access         Compatibility   Deny   Deny    Deny   Deny
  11. Method            Mode         Both   Write   Read   None
  12. ___------------------------------------------------------
  13. Read Only           0           16     32      48     64
  14. Write Only          1           17     33      49     65
  15. Read/Write          2*          18     34      50     66
  16.  
  17.  * = default
  18.  
  19. File locking is seldom useful For Real life applications.
  20. Sometimes however, File locking MAY be appropriate, such as
  21. when a Compiled list is produced at the Printer; if users
  22. are allowed to update the database then, the list can contain
  23. multiple instances of a Record or reference...  :-)
  24.  
  25. Use Record locking instead, when required, For most purposes
  26. and add logic to prevent disasters and user misunderstandings.
  27. Users will generally be more happy if they're not denied
  28. Write access all the time...  :-)
  29.  
  30. RB > Perhaps I need to disable I/O checking and put in some Delays if
  31.    > this File is being accessed simulataneously.  Also, the size of this File
  32.  
  33. Definately disable I/O checking.  Don't add Delays if you
  34. can avoid it.  Beware of dead-lock situations which occur
  35. when two or more users access the same File With inadequate
  36. access rights and they're all put on hold Until the File
  37. is released by the other...  One way to catch these situations
  38. is to retry a specified number of times and then cancel the
  39. operation With an error message perhaps.
  40.